//
//  YueduController.m
//  网易新闻
//
//  Created by dllo on 15/10/5.
//  Copyright (c) 2015年 Lx. All rights reserved.
//

#import "YueduController.h"
#import "TuijianController.h"
#import "DingyueController.h"
#import "SearchController.h"
@interface YueduController ()
@property(nonatomic, retain)UIButton *search;
@end

@implementation YueduController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.search.hidden = NO;
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.search.hidden = YES;
}

- (void)viewDidLoad {
    TuijianController *tuijian = [[TuijianController alloc]init];
    self.controller_a = tuijian;
    DingyueController *dingyue = [[DingyueController alloc]init];
    self.controller_b = dingyue;
    [super viewDidLoad];
    [self createSearchButton];
    [tuijian release];
    [dingyue release];
}

- (void)createSearchButton{
    self.search = [UIButton buttonWithType:UIButtonTypeSystem];
    self.search.frame =CGRectMake(340, 10, 25, 25);
    [self.search setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.search setTitle:@"+" forState:UIControlStateNormal];
    [self.search addTarget:self action:@selector(clickSearch:) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationController.navigationBar addSubview:self.search];
}

- (void)clickSearch:(UIButton *)button{
    SearchController *search = [[SearchController alloc]init];
    search.title = @"订阅感兴趣的";
    [self.navigationController pushViewController:search animated:YES];
    [search release];
}

- (void)setButtonTitle{
    [self.button_a setTitle:@"推荐阅读" forState:UIControlStateNormal];
    [self.button_b setTitle:@"我的订阅" forState:UIControlStateNormal];
}

@end
